package com.runssnail.juhe.api;

import com.runssnail.juhe.api.common.Lifecycle;
import com.runssnail.juhe.api.exception.ApiException;
import com.runssnail.juhe.api.request.Request;
import com.runssnail.juhe.api.response.Response;

/**
 * juhe api client，所有请求都从这里发起
 *
 * @author zhengwei
 */
public interface JuheClient extends Lifecycle {

    String getOpenId();

    /**
     * appKey
     *
     * @return appKey
     */
    String getAppKey();

    /**
     * 请求
     *
     * @param req 请求对象
     * @param <R>
     * @return
     * @throws com.runssnail.juhe.api.exception.ApiException
     */
    <R extends Response> R execute(Request<R> req) throws ApiException;

}
